<template>
  <div class="sub-edit-dropdown-wrap">
    <div class="sub-edit-dropdown-header" @click="changeDropdown">
      {{ props.dropdownTitle }}
      <px-icon>
        <ArrowUp v-show="isDropdown" />
        <ArrowDown v-show="!isDropdown" />
      </px-icon>
    </div>
    <div v-show="isDropdown" class="sub-edit-dropdown-content">
      <slot name="content" />
    </div>
    <div class="sub-edit-dropdown-btn">
      <slot name="btn" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { watch, ref } from "vue";

const props = defineProps(["dropdownTitle"]);
const isDropdown = ref(true);

const changeDropdown = () => {
  isDropdown.value = !isDropdown.value;
};
</script>
<style lang="scss" scoped>
.sub-edit-dropdown-wrap {
  width: 100%;
  position: relative;
  margin-top: 16px;

  .sub-edit-dropdown-header {
    padding-left: 16px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.8);
    line-height: 22px;
    color: rgb(0 0 0 / 80%);
    cursor: pointer;
    position: relative;
    margin-bottom: 16px;
    &::before {
      content: "";
      display: block;
      width: 3px;
      height: 16px;
      background: #3b82f6;
      border-radius: 0px 100px 100px 0px;
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
    }

    .px-icon {
      margin-left: 8px;
      font-size: 16px;
    }
  }

  .sub-edit-dropdown-content {
    width: 100%;
  }

  .sub-edit-dropdown-btn {
    position: absolute;
    top: 0;
    right: 24px;
    height: 40px;
    line-height: 40px;
  }
}
</style>
